package com.github.bridge.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class TemplateContentVO extends BaseVO {

    @Schema(description = "模板id")
    private String templateId;

    @Schema(description = "模板名称")
    private String templateName;

    @Schema(description = "文件类型id")
    private String docTypeId;

    @Schema(description = "文件类型名称")
    private String docTypeName;

    @Schema(description = "模板创建时间")
    private String createTime;

    @Schema(description = "模板更新时间")
    private String updateTime;

    @Schema(description = "内容域实例集合")
    private List<ContentControl> contentsControl;

    @Schema(description = "签署区集合")
    private List<SealControl> sealControl;

    @Data
    public static class ContentControl {

        @Schema(description = "内容域实例id")
        private String contentId;

        @Schema(description = "内容域实例名称")
        private String contentName;

        @Schema(description = "内容域实例格式：<br/>" +
                "TEXT-文本、<br/>" +
                "MOBILE-手机号、<br/>" +
                "ID_CARD-身份证号、<br/>" +
                "MAIL-邮箱、<br/>" +
                "UNITED_CODE-社会信用代码、<br/>" +
                "NUMBER-数字、<br/>" +
                "DATE-日期、<br/>" +
                "SINGLE-单选、<br/>" +
                "MULTIPLE-多选、<br/>" +
                "FORM-动态表格、<br/>" +
                "IMAGE-图片")
        private String contentFormat;

        @Schema(description = "内容域实例校验规则 <br/>" +
                "contentFormat= TEXT-文本，返回数字，表示允许输入的长度。<br/>" +
                "contentFormat= MOBILE-手机号，返回空字符串，使用默认规则：11位1开头的数字。<br/>" +
                "contentFormat= ID_CARD-身份证号，返回空字符串，使用默认规则：18位，由数字或大写英文字母组成。<br/>" +
                "contentFormat= MAIL-邮箱，返回空字符串，使用默认规则：邮箱格式。<br/>" +
                "contentFormat= UNITED_CODE-统一社会信用代码，返回空字符串，使用默认规则：18位，由数字或大写英文字母组成。<br/>" +
                "contentFormat= NUMBER-数字，返回数字，表示允许输入的小数位数。<br/>" +
                "contentFormat= DATE-日期，返回日期格式，如\"yyyy年MM月dd日\"。<br/>" +
                "contentFormat= IMAGE-图片，返回数字，代表图片类型，1-身份证横排、2-身份证竖排、3-其他。<br/>" +
                "contentFormat= SINGLE-单选，返回单选项组，如：['单选项一','单选项二']<br/>" +
                "contentFormat= MULTIPLE-多选，返回多选项组，如：['多选项一','多选项二']<br/>" +
                "contentFormat= FORM-动态表格，返回null，动态表格列内容具体在contentCodeInfos中返")
        private String contentFormatRule;

        @Schema(description = "是否必填： 0否 1是")
        private String required;

        @Schema(description = "内容域实例参数编码。可在天印V6的业务系统的【文本域管理】菜单中设置。")
        private String contentCode;

        private List<ContentCodeInfo> contentCodeInfos;

    }

    @Data
    public static class ContentCodeInfo {
        @Schema(description = "列名称")
        private String columnContentName;

        @Schema(description = "列id")
        private String columnContentId;

        @Schema(description = "列参数编码")
        private String columnContentCode;

    }

    @Data
    public static class SealControl {
        @Schema(description = "签署区名称")
        private String sealControlName;
        @Schema(description = "签署区id")
        private String sealControlId;
        @Schema(description = "是否允许移动，0否，1是；")
        private Boolean allowMove;
        @Schema(description = "1 正文章 2 骑缝章")
        private Integer sealControlType;
        @Schema(description = "正文章签署范围：0-当前页 1-所有页 3-指定页")
        private Integer signatureScope;
        @Schema(description = "骑缝章签署范围：0指定页（默认全选），1奇数页，2偶数页，默认0")
        private Integer edgeScope;
        @Schema(description = "X坐标 PDF文件以页面左下角为原点，x偏移量正数向右偏移，负数向左偏移 OFD文件不返回坐标")
        private Float posX;
        @Schema(description = "Y坐标 PDF文件以页面左下角为原点，y偏移量正数向上偏移，负数向下偏移 OFD文件不返回坐标")
        private Float posY;
        @Schema(description = "页码")
        private String page;
        @Schema(description = "签署日期信息")
        private SignDateInfo signDateInfo;
    }

    @Data
    public static class SignDateInfo {
        @Schema(description = "签署日期格式;YYYY-MM-DD、YYYY年MM月DD日、YYYY/MM/DD")
        private String dateFormat;
        @Schema(description = "X坐标 PDF文件以页面左下角为原点，x偏移量正数向右偏移，负数向左偏移 OFD文件不返回坐标")
        private Float posX;
        @Schema(description = "Y坐标 PDF文件以页面左下角为原点，y偏移量正数向上偏移，负数向下偏移 OFD文件不返回坐标")
        private Float posY;
    }

}
